<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <button id="loginBtn">登录</button>
  <script>
    var createLogin = function (a, b, c) {
      console.log(a, b, c)
      var div = document.createElement('div')
      div.innerHTML = '我是登录弹窗'
      div.style.display = 'none'
      document.body.appendChild(div)
      return div
    }
    var getSingle = function (fn) {
      var result
      return function () {
        console.log('result', result)
        return result || (result = fn.apply(this, arguments))
      }
    }
    var create = getSingle(createLogin)
    document.getElementById('loginBtn').onclick = function () {
      var loginLay = create(1, 2, 3)
      loginLay.style.display = 'block'
    }
  </script>
</body>
</html>